<?php
// TbBox1
$this->beginWidget('bootstrap.widgets.TbBox', array(
	'title' => array($this->projectName => array('project/schema'), '同义词管理'),
	'headerIcon' => 'icon-pause',
));
// Tips
Yii::app()->user->setFlash('info', '小提示：搜索 "原词" 可以同时检索到 "同义词" 的相关记录。');
$this->widget('bootstrap.widgets.TbAlert', array(
	'block' => true, // display a larger alert block?
	'fade' => true, // use transitions?
	'closeText' => '×', // close link text - if set to false, no close link is displayed
	'alerts' => array('info'),
));
// List
$this->widget('bootstrap.widgets.TbExtendedGridView', array(
	'type' => 'striped bordered condensed',
	'dataProvider' => $gridDataProvider,
	'rowCssClassExpression' => '$data["isRemoved"]?"removed":""',
	'template' => "{items}",
	'columns' => array(
		array(
			'name' => 'word',
			'header' => '原词',
		),
		array(
			'name' => 'synonym',
			'header' => '同义词',
		),
		array(
			'class' => 'bootstrap.widgets.TbButtonColumn',
			'template' => '{delete}',
			'deleteButtonUrl' => 'array("project/synonymDelete","word"=>$data["word"],"synonym"=>$data["synonym"])',
		),
	),
));
?>
<div class="pagination pagination-centered">
	<ul class="yiiPager">
		<?php
		echo CHtml::tag('li', array(
			'class' => 'previous' . ($hasPrev ? '' : ' disabled'),
				), CHtml::link('&larr;上一页', $hasPrev ? array($this->route, 'page' => $page - 1) : 'javascript:'));
		echo CHtml::tag('li', array(
			'class' => 'next' . ($hasNext ? '' : ' disabled'),
				), CHtml::link('下一页&rarr;', $hasNext ? array($this->route, 'page' => $page + 1) : 'javascript:'));
		?>
	</ul>
</div>
<?php
// result tips
$this->widget('bootstrap.widgets.TbAlert', array(
	'block' => true, // display a larger alert block?
	'fade' => true, // use transitions?
	'closeText' => '×', // close link text - if set to false, no close link is displayed
	'alerts' => array('success', 'error'),
));
// form
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
	'type' => 'inline',
	'htmlOptions' => array('enctype' => 'multipart/form-data'),
)); /* @var $form TbActiveForm */
?>
<hr />
<div class="row-fluid">
	<div class="span4">
		<?php echo $form->labelEx($model, 'word'); ?>
		<?php echo $form->textField($model, 'word', array('class' => 'input-large span8')); ?>
	</div>
	<div class="span4">
		<?php echo $form->labelEx($model, 'synonym'); ?>
		<?php echo $form->textField($model, 'synonym', array('class' => 'input-large span8')); ?>
	</div>
	<div class="span4">
		<?php
		$this->widget('bootstrap.widgets.TbButton', array(
			'buttonType' => 'submit',
			'type' => 'primary',
			'label' => '添加同义词',
		));
		?>	
	</div>
</div>
<hr />
<div class="row-fluid">
	<div class="span8">
		<?php
		echo $form->labelEx($model, 'file');
		echo $form->fileField($model, 'file', array('class' => 'span8', 'accept' => 'text/csv'));
		?>
	</div>
	<div class="span4">
		<?php
		$this->widget('bootstrap.widgets.TbButton', array(
			'buttonType' => 'submit',
			'type' => 'primary',
			'label' => '导入',
			'htmlOptions' => array('name' => 'import'),
		));
		?>
		<?php
		$this->widget('bootstrap.widgets.TbButton', array(
			'label' => '导出',
			'url' => array('project/synonymExport'),
			'disabled' => $gridDataProvider->totalItemCount === 0,
		));
		?>
	</div>
</div>
<?php
$this->endWidget(); // form
$this->endWidget(); // TbBox2
